package com.yinxin.thread;

import com.yinxin.util.WebDownLoader;

/**
 * @author yinxin
 * @Title:
 * @Package
 * @Description:
 * @date 2022/1/79:50
 */
public class downloadImageThread extends Thread{
   private String url;
   private String pageName;

   public downloadImageThread(String url,String pageName){
      this.pageName=pageName;
      this.url=url;
   }

   @Override
   public void run() {
      WebDownLoader webDownLoader = new WebDownLoader();
      webDownLoader.downLoader(url,pageName);
      System.out.println("下载了文件名为："+pageName);
   }

   public static void main(String[] args) {
      downloadImageThread t1 = new downloadImageThread("https://cdn.cnbj1.fds.api.mi-img.com/product-images/mi120mmgce/3402.jpg", "t1.jpg");
      downloadImageThread t2 = new downloadImageThread("https://cdn.cnbj1.fds.api.mi-img.com/product-images/redmik40/seciton2-1.jpg", "t2.jpg");
      downloadImageThread t3 = new downloadImageThread("https://cdn.cnbj1.fds.api.mi-img.com/product-images/redmik40/seciton3-1.jpg", "t3.jpg");
      t3.start();
      t2.start();
      t1.start();
   }
}
